package com.pan.admin.module.distribute.service.impl;

import com.pan.admin.common.utils.DateUtils;
import com.pan.admin.common.utils.SecurityUtils;
import com.pan.admin.module.distribute.dao.LoanDistributeDao;
import com.pan.admin.module.distribute.entity.LoanDistribute;
import com.pan.admin.module.distribute.service.LoanDistributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 智能分配子链接Service业务层处理
 * 
 * @author ts
 * @date 2023-09-10
 */
@Service
public class LoanDistributeServiceImpl implements LoanDistributeService {
    @Autowired
    private LoanDistributeDao loanDistributeDao;

    /**
     * 根据ID获取列表智能分配子链接
     * 
     * @param id 智能分配子链接主键
     * @return 智能分配子链接
     */
    @Override
    public LoanDistribute getById(Long id) {
        return loanDistributeDao.getById(id);
    }

    /**
     * 查询智能分配子链接列表
     * 
     * @param loanDistribute 智能分配子链接
     * @return 智能分配子链接
     */
    @Override
    public List<LoanDistribute> list(LoanDistribute loanDistribute) {
        return loanDistributeDao.list(loanDistribute);
    }

    /**
     * 新增智能分配子链接
     * 
     * @param loanDistribute 智能分配子链接
     * @return 结果
     */
    @Override
    public int insertLoanDistribute(LoanDistribute loanDistribute) {
        loanDistribute.setCreateTime(DateUtils.getNowDate());
        loanDistribute.setCreateBy(SecurityUtils.getUsername());
        return loanDistributeDao.insertLoanDistribute(loanDistribute);
    }

    /**
     * 修改智能分配子链接
     * 
     * @param loanDistribute 智能分配子链接
     * @return 结果
     */
    @Override
    public int updateLoanDistribute(LoanDistribute loanDistribute) {
        loanDistribute.setUpdateTime(DateUtils.getNowDate());
        loanDistribute.setUpdateBy(SecurityUtils.getUsername());
        return loanDistributeDao.updateLoanDistribute(loanDistribute);
    }

    /**
     * 批量删除智能分配子链接
     * 
     * @param ids 需要删除的智能分配子链接主键
     * @return 结果
     */
    @Override
    public int batchDeleteById(Long[] ids) {
        return loanDistributeDao.batchDeleteById(ids);
    }

    /**
     * 删除智能分配子链接信息
     * 
     * @param id 智能分配子链接主键
     * @return 结果
     */
    @Override
    public int deleteById(Long id) {
        return loanDistributeDao.deleteById(id);
    }
}
